package com.huawei.esdk.tp.northcommu.cxf.professional.convert;

import java.util.List;
import com.huawei.esdk.platform.common.SDKResult;
import com.huawei.esdk.tp.domain.model.bean.OrganizationItem;
import com.huawei.esdk.tp.northcommu.cxf.professional.gen.OrganizationItemEx;
import com.huawei.esdk.tp.northcommu.cxf.professional.gen.QueryOrganizationExResponse;

public class TPProfessionalOrgaMgrConvert
{
    
    public QueryOrganizationExResponse queryOrganizationExModal2Soap
            (SDKResult<List<OrganizationItem>> organizations)
    {
        QueryOrganizationExResponse response = new QueryOrganizationExResponse();
        response.setResultCode((int)organizations.getErrCode());
        if(0 == response.getResultCode())
        {
            List<OrganizationItem> orgas = organizations.getResult();
            for(OrganizationItem item : orgas)
            {
                OrganizationItemEx orga = new OrganizationItemEx();
                orga.setId(item.getId());
                orga.setName(item.getName());
                response.getOrgs().add(orga);
            }
        }
        return response;
    }
    
}
